﻿using System.Windows.Input;
using Bookvar.UI.Actions;
using Bookvar.UI.Commands;
using LocalizationResources = Bookvar.UI.Localization.Resources;

namespace Bookvar.UI.ViewModel.LiveImages
{
    public partial class LiveImagesViewModel
    {
        #region Nested type: AddLiveImageCommand

        private class AddLiveImageCommand : CommandModel
        {
            public AddLiveImageCommand() : base( BookvarCommands.AddImage )
            {
            }

            protected internal override void OnExecute( object sender, ExecutedRoutedEventArgs e )
            {
                var param = (LiveImageInfo) e.Parameter;
                var addWebImageAction = new AddWebImageAction( param.ImageInfo, param.ImageSize,
                                                                    param.ThumbnailSource );

                ActionService.Execute( addWebImageAction );
            }


            protected internal override void OnCanExecute( object sender, CanExecuteRoutedEventArgs e )
            {
                e.CanExecute = true;
                e.Handled = true;
            }
        }

        #endregion
    }
}